import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import dts from "vite-plugin-dts";

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueJsx(),
    dts({
      insertTypesEntry: true, // 在 package.json 中自动生成 types 字段
      include: ["src/factory"], // 指定需要生成类型声明的文件
    }),
  ],
  build: {
    lib: {
      entry: "src/factory/index.ts",
      name: "naive-factory",
      fileName: "index",
    },
    rollupOptions: {
      external: ["vue", "vue-router", "naive-ui"],
      output: {
        globals: {
          vue: "Vue",
          "vue-router": "vueRouter",
          "naive-ui": "naiveUi",
        },
      },
    },
  },
});
